home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Text / print / HPDJ400Src.lha / init.asm < prev    next >
Assembly Source File  |  1999-11-21  |  5KB  |  161 lines

  1. *
  2. * Copyright (c) 1992 Commodore-Amiga, Inc.
  3. *
  4. * This example is provided in electronic form by Commodore-Amiga, Inc. for
  5. * use with the "Amiga ROM Kernel Reference Manual: Devices", 3rd Edition,
  6. * published by Addison-Wesley (ISBN 0-201-56775-X).
  7. *
  8. * The "Amiga ROM Kernel Reference Manual: Devices" contains additional
  9. * information on the correct usage of the techniques and operating system
  10. * functions presented in these examples.  The source and executable code
  11. * of these examples may only be distributed in free electronic form, via
  12. * bulletin board or as part of a fully non-commercial and freely
  13. * redistributable diskette.  Both the source and executable code (including
  14. * comments) must be included, without modification, in any copy.  This
  15. * example may not be published in printed form or distributed with any
  16. * commercial product.  However, the programming techniques and support
  17. * routines set forth in these examples may be used in the development
  18. * of original executable software products for Commodore Amiga computers.
  19. *
  20. * All other rights reserved.
  21. *
  22. * This example is provided "as-is" and is subject to change; no
  23. * warranties are made.  All use is at your own risk. No liability or
  24. * responsibility is assumed.
  25. *
  26. **********************************************************************
  27. *
  28. *       printer device functions
  29. *
  30. **********************************************************************
  31.  
  32.         SECTION         printer
  33.  
  34. *------ Included Files -----------------------------------------------
  35.  
  36.         INCLUDE         "exec/types.i"
  37.         INCLUDE         "exec/nodes.i"
  38.         INCLUDE         "exec/lists.i"
  39.         INCLUDE         "exec/memory.i"
  40.         INCLUDE         "exec/ports.i"
  41.         INCLUDE         "exec/libraries.i"
  42.  
  43.         INCLUDE         "macros.i"
  44.  
  45. *------ Imported Functions -------------------------------------------
  46.  
  47.         XREF_EXE        CloseLibrary
  48.         XREF_EXE        OpenLibrary
  49.         XREF            _AbsExecBase
  50.  
  51.  
  52.         XREF            _PEDData
  53.  
  54.  
  55. *------ Exported Globals ---------------------------------------------
  56.  
  57.         XDEF            _Init
  58.         XDEF            _Expunge
  59.         XDEF            _Open
  60.         XDEF            _PD
  61.         XDEF            _PED
  62.         XDEF            _SysBase
  63.         XDEF            _DOSBase
  64.         XDEF            _GfxBase
  65.         XDEF            _IntuitionBase
  66.  
  67.  
  68. **********************************************************************
  69.         SECTION         printer,DATA
  70. _PD             DC.L    0
  71. _PED            DC.L    0
  72. _SysBase        DC.L    0
  73. _DOSBase        DC.L    0
  74. _GfxBase        DC.L    0
  75. _IntuitionBase  DC.L    0
  76.  
  77.  
  78. **********************************************************************
  79.         SECTION         printer,CODE
  80. _Init:
  81.                 MOVE.L  4(A7),_PD
  82.                 LEA     _PEDData(PC),A0
  83.                 MOVE.L  A0,_PED
  84.                 MOVE.L  A6,-(A7)
  85.                 MOVE.L  _AbsExecBase,A6
  86.                 MOVE.L  A6,_SysBase
  87.  
  88. *           ;------ open the dos library
  89.                 LEA     DLName(PC),A1
  90.                 MOVEQ   #0,D0
  91.                 CALLEXE OpenLibrary
  92.                 MOVE.L  D0,_DOSBase
  93.                 BEQ     initDLErr
  94.  
  95.  
  96. *           ;------ open the graphics library
  97.                 LEA     GLName(PC),A1
  98.                 MOVEQ   #0,D0
  99.                 CALLEXE OpenLibrary
  100.                 MOVE.L  D0,_GfxBase
  101.                 BEQ     initGLErr
  102.  
  103. *           ;------ open the intuition library
  104.                 LEA     ILName(PC),A1
  105.                 MOVEQ   #0,D0
  106.                 CALLEXE OpenLibrary
  107.                 MOVE.L  D0,_IntuitionBase
  108.                 BEQ     initILErr
  109.  
  110.                 MOVEQ   #0,D0
  111. pdiRts:
  112.                 MOVE.L  (A7)+,A6
  113.                 RTS
  114.  
  115. initPAErr:
  116.                 MOVE.L  _IntuitionBase,A1
  117.                 LINKEXE CloseLibrary
  118.  
  119. initILErr:
  120.                 MOVE.L  _GfxBase,A1
  121.                 LINKEXE CloseLibrary
  122.  
  123. initGLErr:
  124.                 MOVE.L  _DOSBase,A1
  125.                 LINKEXE CloseLibrary
  126.  
  127. initDLErr:
  128.                 MOVEQ   #-1,D0
  129.                 BRA.S   pdiRts
  130.  
  131. ILName:
  132.                 DC.B    'intuition.library'
  133.                 DC.B    0
  134. DLName:
  135.                 DC.B    'dos.library'
  136.                 DC.B    0
  137. GLName:
  138.                 DC.B    'graphics.library'
  139.                 DC.B    0
  140.                 DS.W    0
  141.  
  142.  
  143. *---------------------------------------------------------------------
  144. _Expunge:
  145.                 MOVE.L  _IntuitionBase,A1
  146.                 LINKEXE CloseLibrary
  147.  
  148.                 MOVE.L  _GfxBase,A1
  149.                 LINKEXE CloseLibrary
  150.  
  151.                 MOVE.L  _DOSBase,A1
  152.                 LINKEXE CloseLibrary
  153.  
  154.  
  155. *---------------------------------------------------------------------
  156. _Open:
  157.                 MOVEQ   #0,D0
  158.                 RTS
  159.  
  160.                 END
  161.